<?php


namespace app\common\cachemodel;


use app\common\model\BaseCache;
use think\Exception;

class CouponUseRange extends BaseCache
{
    protected $table = 'wechat_backup_07_18_14_43_00.zl_coupon_use_range';

    protected $cacheModel = 'coupon.use_range';


    public function getInfoByIds($ids)
    {
        $data = $this->batchGetInfoByIds($ids);

        foreach ($data as $k => $v)
        {
            $data[$k] = explode("\r\n", $v['use_range']);
        }

        return $data;
    }


    public function getInfoByIdsInData($ids, $type, $sortType)
    {
        try
        {
            $data = $this->whereIn('id', $ids)->column('name,use_range', 'id');
        }
        catch (Exception $e)
        {
            $data = [];
        }

        return $data;
    }
}
